<template>
  <div class="cart-list">
    <scroll class="content" ref="scroll">
      <div>
        <cart-list-item v-for="item in cartList" :key="item.iid" :item-info="item"></cart-list-item>
      </div>
    </scroll>
  </div>
</template>

<script>
import Scroll from 'components/common/scroll/Scroll'
import CartListItem from './CartListItem'

import { mapGetters } from 'vuex'

export default {
  name: 'CartList',
  components: {
    Scroll,
    CartListItem,
  },
  computed: {
    ...mapGetters(['cartList'])
  },
  // 不能在created和mounted中进行刷新，因为做了缓存
  activated() {
    this.$refs.scroll.refresh()
  },
}
</script>

<style scoped>
  /* .cart_list {
    height: calc(100% - 44px -49px - 50px);
  } */
  /* 汇总高度是44px */
  .cart-list {
    position: absolute;
    top: 44px;
    /* bottom: 49px; */
    bottom: 93px;
    width: 100%;
  }
  .content {
    height: 100%;
    overflow: hidden;
  }
  
</style>

